home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
526-550
/
disk_540
/
parm
/
parmcmds
/
parmcd.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
2KB
|
62 lines
/*
* ParMCD.c - Copyright © 1990 by Devil's child.
*
* Created: 08 Oct 1990 20:51:16
* Modified: 21 Nov 1990 17:15:45
*
* Make>> cc -qf -ps -m0b -wp -wd -wu -so -hi ram:ParM.syms <file>.c
* Make>> ln <file>.o
* Make>> Protect <file> +p
*/
#include <arp_ports.h>
void ParMCD(long len, char *line);
#pragma regcall(ParMCD(d0,a0))
void ParMCD(long len, char *line)
{
struct ExecBase *SysBase = *((struct ExecBase **)4L);
struct ArpBase *ArpBase;
struct Process *MyProcess;
short argc;
char *argv[2];
struct InfoData *infodata;
long args[8];
struct Window *W;
struct MsgPort *ReplyPort;
struct IntuiMessage Msg;
char dir[120];
if (!(ArpBase = (struct ArpBase *)OpenLibrary("arp.library", 39L))) return;
MyProcess = (struct Process *)SysBase->ThisTask;
SysBase->ThisTask->tc_UserData = (APTR)&ArpBase; /* for GADS() ??? used to be for my resident Printf() */
argc = GADS(line, len, "Usage: ParMCD [New current directory name]", (char **)&argv, "Dir");
if (argc < 0) {
Puts(argv[0]);
ArpExit(20L, ERROR_LINE_TOO_LONG);
}
infodata = ArpAlloc(sizeof(struct InfoData));
args[0] = (long)infodata >> 2;
SendPacket(ACTION_DISK_INFO, args, (struct MsgPort *)MyProcess->pr_ConsoleTask);
W = (struct Window *)infodata->id_VolumeNode;
if ( (W->IDCMPFlags & MENUPICK) && (ReplyPort = CreatePort(NULL, NULL)) ) {
PathName( MyProcess->pr_CurrentDir, dir, 80);
Msg.Class = 0x0FL;
if (argv[0])
Msg.IAddress = (APTR)argv[0];
else
Msg.IAddress = (APTR)dir;
Msg.ExecMessage.mn_Node.ln_Type = NT_MESSAGE;
Msg.ExecMessage.mn_Length = sizeof( struct IntuiMessage );
Msg.ExecMessage.mn_ReplyPort = ReplyPort;
PutMsg(W->UserPort, (struct Message *)&Msg);
WaitPort(ReplyPort);
GetMsg(ReplyPort);
DeletePort(ReplyPort);
}
CloseLibrary(ArpBase);
}